﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pStr
{
    class CTime
    {
        public int hour;
        public CTime(int ahour)
        {
            hour = ahour;
        }
    }

    class Program
    {
        public static void method1(CTime t)
        {
            t.hour = 12;
            t = new CTime(15);
        }

        public static void method2(ref CTime t)
        {
            t.hour = 12;
            t = new CTime(15);
        }
        static void Main(string[] args)
        {
            //string s = "나는 reference타입";
            //Console.WriteLine(s);

            CTime C1 = new CTime(9);
            method1(C1);
            CTime C2 = new CTime(9);
            method2(ref C2);
            Console.WriteLine("값으로 넘겼을때:" + C1.hour);
            Console.WriteLine("참조값으로 넘겼을때:" + C2.hour);
        }
    }
}
